package movee.io.cmd.service;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import java.sql.Timestamp;
import java.util.List;

/**
 *
 *
 * @author movee
 */
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class CmdEchoDto {

    private Integer status;
    private String msg;
    private ActiveCommand datas;

    @Data
    @SuperBuilder
    @NoArgsConstructor
    @AllArgsConstructor
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class ActiveCommand {
        private Integer status;

        private String uniqueId;

        private String nwId;

        private String result;

        private List<EchoStep> echo;

        private String domain;

        private String warehouse;

        private String commandTemplateId;

        private String commandName;

        private String commandParams;

        private String protocol;

        private Integer retryTime;

        private Boolean userConfirm;

        private String userName;

        private String nextCmdId;

        private String bulkCmdId;

        @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Timestamp createTime;

        @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Timestamp updateTime;

    }

    @Data
    @SuperBuilder
    @NoArgsConstructor
    @AllArgsConstructor
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class EchoStep {

        @JsonProperty(value = "step-index")
        private Integer stepIndex;

        @JsonProperty(value = "step-command")
        private String stepCommand;

        @JsonProperty(value = "step-echo")
        private String stepEcho;
    }

}
